package com.xnyzc.lhy.task.task.statistics;

import com.xnyzc.lhy.task.fegin.statistics.IndexOrderStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component("quartzIndexStatistics")
public class QuartzIndexStatistics {
    private  static Long computeDate = 0L;
    @Autowired
    private IndexOrderStatisticsService indexOrderStatisticsService;

    @Scheduled(cron = "0 */5 * * * ?")
    public void saveIndexOrderStaticalData(){
        log.info("====================开始保存首页订单统计数据=================");
        long startTime = System.currentTimeMillis();
        indexOrderStatisticsService.saveIndexOrderStaticalData(computeDate);
        computeDate = System.currentTimeMillis()-startTime;
        log.info("====================结束保存首页订单统计数据=================");
    }
}
